package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.system.domain.FaApsDevicetype;
import com.ruoyi.system.mapper.FaApsDeviceMapper;
import com.ruoyi.system.domain.FaApsDevice;
import com.ruoyi.system.service.IFaApsDeviceService;

/**
 * 设备Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-09-16
 */
@Service
public class FaApsDeviceServiceImpl implements IFaApsDeviceService 
{
    @Autowired
    private FaApsDeviceMapper faApsDeviceMapper;

    /**
     * 查询设备
     * 
     * @param deviceId 设备主键
     * @return 设备
     */
    @Override
    public FaApsDevice selectFaApsDeviceByDeviceId(Integer deviceId)
    {
        return faApsDeviceMapper.selectFaApsDeviceByDeviceId(deviceId);
    }

    /**
     * 查询设备列表
     * 
     * @param faApsDevice 设备
     * @return 设备
     */
    @Override
    public List<FaApsDevice> selectFaApsDeviceList(FaApsDevice faApsDevice)
    {
        return faApsDeviceMapper.selectFaApsDeviceList(faApsDevice);
    }

    /**
     * 新增设备
     * 
     * @param faApsDevice 设备
     * @return 结果
     */
    @Transactional
    @Override
    public int insertFaApsDevice(FaApsDevice faApsDevice)
    {
        faApsDevice.setCreateTime(DateUtils.getNowDate());
        int rows = faApsDeviceMapper.insertFaApsDevice(faApsDevice);
        return rows;
    }

    /**
     * 修改设备
     * 
     * @param faApsDevice 设备
     * @return 结果
     */
    @Transactional
    @Override
    public int updateFaApsDevice(FaApsDevice faApsDevice)
    {
        faApsDevice.setUpdateTime(DateUtils.getNowDate());
        return faApsDeviceMapper.updateFaApsDevice(faApsDevice);
    }

    /**
     * 批量删除设备
     * 
     * @param deviceIds 需要删除的设备主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteFaApsDeviceByDeviceIds(Integer[] deviceIds)
    {
        return faApsDeviceMapper.deleteFaApsDeviceByDeviceIds(deviceIds);
    }

    /**
     * 删除设备信息
     * 
     * @param deviceId 设备主键
     * @return 结果
     */
    @Override
    public int deleteFaApsDeviceByDeviceId(Integer deviceId)
    {
        return faApsDeviceMapper.deleteFaApsDeviceByDeviceId(deviceId);
    }
}
